Development
Prev
Next

Appendix A. Development

Table of Contents

Compilation
Design notes
Translation

Compilation

1. Software requirements

1.1 Compilation with Windows Server 2003 DDK

The best way to build UltraDefrag is to use the Windows Server 2003 Driver Development Kit (DDK). You can simply download it from one of the locations that can be found using any web search system (e.g. Google).

The only disadvantage of this method is that the Windows DDK is a really big package (about 230 Mb). However, if you have an internet connection with a good download rate, its should not be a large problem.

1.2 Compilation with MinGW

Other interesting way to produce UltraDefrag package is to do so using MinGW. GNU C Compiler (GCC) has one important advantage over the Microsoft C compiler, it produces many useful warnings for code that is not completely within the C standard. I have removed hundreds of small bugs from UltraDefrag thanks to the warnings produced by GCC. The biggest disadvantage of gcc is that it produces larger executables than the microsoft compiler, e.g. a driver produced by DDK may have 22.0 Kb size, but the same driver produced by GCC is only about 32.0 kb.

You can either download MinGW from mingw.org or download MinGW Developer Studio from parinyasoft.com (about 25 Mb).

Note that the MinGW build system can only build i386 binaries.

VERY IMPORTANT NOTE: If you build the dynamic libraries from the MinGW Developer Studio, the resulting *.a files are invalid. This is because I don't know how to specify linker options in Developer Studio's project file. Use makefiles instead:

mingw32-make Makefile.mingw

1.3 Compilation with Microsoft Visual Studio 6.0

This is another method for building UltraDefrag. It does not require the DDK. You can use Microsoft C compiler included in MS Visual Studio version 6.0 or later.

To use this method you will need to obtain a copy of ReactOS source code from ReactOS website for special header files used to build the driver.

You will also need to download the following files: ntdll.lib and ntoskrnl.lib + hal.lib (included in KmdKit package). Put these files to lib subdirectory of your Visual Studio installation.

VERY IMPORTANT NOTE: The winnt.h file in visual studio 6.0 contains an incorrect definition of the NtCurrentTeb function. Therefore replace the following lines:

#if defined(_M_ALPHA)
#define NtCurrentTeb() ((struct _TEB *)_rdteb())
#else
struct _TEB *
NtCurrentTeb(void);
#endif
with:
#if defined(_M_ALPHA)
#define NtCurrentTeb() ((struct _TEB *)_rdteb())
#else
struct _TEB *
__stdcall NtCurrentTeb(void);
#endif

Finally, edit ultradfg.dsp file (driver project file), and ensure that the reactos header paths are properly set.

Note that currently only i386 binaries can be produced using this way.

1.4 Common tools

There are a few other tools that you should have installed on your PC to perform a full-featured build:

1.5 Software recommended for debugging purposes

Because the actual work done by UltraDefrag is done by kernel mode driver, you can download the tools described below to troubleshoot bugs. Even if you are not programmer, these tools may be very useful for you:

1.6 Especially for Mr. Random Newbe (Some notes for the beginners)

Many of described tools have small size, and you don't need high-speed internet connection to download their latest versions. Simply do it.

If you will place tools executables in one of the directories, specified in your PATH environment variable, the command execution will be very easy process, because you can type commands without paths in the command prompt.

2. Building and installation

  1. Download source archive and unpack it somewhere. NOTE: Currently path must not contain spaces. If you have some ideas how to fix that send your report to the authors, please.
  2. Configure build options by typing the following command:
    perl configure.pl

    This tool has a graphical interface. Enter the paths to prerequisite libraries and other options. If you prefer to use MinGW, click the button Apply patch to MinGW to replace some libraries included in MinGW (libntdll.a and libntoskrnl.a) with more adequate versions. Old libraries will be saved in files with additional suffix '.orig'.

    Here is an example:


  3. To build UltraDefrag use the BUILD.CMD script:
    build              - perform the build using default options
    build --install    - run installer silently after the build
    build [--use-winddk or --use-mingw or --use-msvc] [--install]
    		   - specify your favorite compiler
    build --clean      - perform full cleanup instead of the build
    build --help       - show help message
    
  4. To build UltraDefrag Micro Edition package use the build-micro.cmd scipt. It has the same options that build.cmd has. After a successfull compilation you will have ready to use binary packages, but the source code archive will not be produced (to increase the compilation speed). To make an archive of sources run build.cmd script.
Prev
Next
Home


ultradefrag.sourceforge.net SourceForge.net Homepage